<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
</head>
<style>
    .yanglaoban {
        font-size: 30px;
        color: red
    }
</style>

<body>
    <div id="box"></div>
    <div id="box1"></div>
    <script type="text/javascript" src="./js/react.development.js"></script>
    <!-- 提供了操作DOM的react扩展库 -->
    <script type="text/javascript" src="./js/react-dom.development.js"></script>
    <!-- 解析jsx语法的代码转换为js语法 -->
    <script type="text/javascript" src="./js/babel.min.js"></script>
    <script src="./js/prop-types.js"></script>
    <script type="text/babel">
        let color = {color:'red',fontSize:'30px'};
        class Component1 extends React.Component {
            constructor(props) {
                super(props);
                this.state = {
                    arr:[{name:'tom',age:10},{name:'rose',age:18},{name:'jack',age:24}]
                }
            }

            render() {
                return (
                    <div>
                        <h1>列表渲染</h1>
                        {/* map返回的值是一个新数据 key必须是一个唯一的标识 在react中推荐使用map进行列表渲染 */}
                        <ul>{this.state.arr.map((item,index)=><li key={index}>{item.name}</li>)}</ul>
                        <h1>class(className)类型的方式</h1>
                        <div className='yanglaoban'>杨老板的发型真帅！！下课你们都来表扬一下！！</div>
                        <h1>行内样式 Facebook主张方式</h1>
                        <div style={{color:'green'}}>都穿正装</div>
                        <h1>原型链和全局变量</h1>
                        <div style={color}>全局变量</div>
                        <div style={this.col}>原型对象</div>
                    </div>
                );
            }
    }
    Component1.prototype.col = {
        color:'pink',
        fontSize:'50px'
    }

    ReactDOM.render(<Component1/>, document.getElementById("box"));


   
</script>
</body>

</html>